import "./App.css";
import Calendar from "./views/Calendar/Calendar";
import Login from "./views/Login/Login";
import Message from "./views/Message/Message";
import My from "./views/My/My";
import Project from "./views/Project/Project";
import Staff from "./views/Staff/Staff";
import Vacation from "./views/Vacation/Vacation";
import Website from "./views/Website/Website";
import Step1 from "./views/Login/register/step1";
import Step2 from "./views/Login/register/step2";
import WebsiteDetail from "./views/Website/WebsiteDetail/Index";
import MessageDetail from "./views/Message/messageDetail/MessageDetail";
import CrowdDetail from "./views/Message/CrowdDetail/Index";
import { BrowserRouter as Router, Route, Routes } from "react-router-dom";
import Step3 from "./views/Login/register/step3";
import Step4 from "./views/Login/register/step4";
import Success from "./views/Login/success/success";
import Setup from "./views/My/Setup";
import TaskDetail from "./views/Project/TaskDetail";
import Detail from "./views/Project/detail";
import AdminEventClick from "./views/admin-Dashboard/eventClick";
import MemberEventClick from "./views/member-Dashboard/eventClick";
import AdminDashboard from "./views/admin-Dashboard/Dashboard";
import MemberDashboard from "./views/member-Dashboard/Dashboard";
import { PermissionGuard } from "./components/auth/Permissionguard";
import Unauthorized from "./views/Unauthorized/Unauthorized";
import { PERMISSIONS, ROLES } from "./config/permissions";
import { AuthGuard } from "./components/auth/AuthGuard";

// 全局状态管理
// import { GlobalProvider } from "./store/GlobalContext";

function App() {
  return (
    <Router>
      <Routes>
        <Route path="/login" exact element={<Login />} />
        <Route path="/step1" exact element={<Step1 />} />
        <Route path="/step2" exact element={<Step2 />} />
        <Route
          path="/admin-dashboard"
          element={
            <PermissionGuard
              permissions={["manage_users", "manage_content"]}
              roles={["admin"]}
            >
              <AdminDashboard />
            </PermissionGuard>
          }
        />
        <Route
          path="/member-dashboard"
          element={
            <AuthGuard>
              <PermissionGuard
                roles={[ROLES.MEMBER, ROLES.ADMIN]}
                permissions={[PERMISSIONS.VIEW_CONTENT]}
              >
                <MemberDashboard />
              </PermissionGuard>
            </AuthGuard>
          }
        />
        <Route path="/project" exact element={<Project />} />
        <Route path="/staff" exact element={<Staff />} />
        <Route path="/vacation" exact element={<Vacation />} />
        <Route path="/calendar" exact element={<Calendar />} />
        <Route path="/message" exact element={<Message />} />
        <Route path="/my" exact element={<My />} />
        <Route path="/setup" exact element={<Setup />} />
        <Route path="/website" exact element={<Website />} />
        <Route path="/step3" exact element={<Step3 />} />
        <Route path="/step4" exact element={<Step4 />} />
        <Route path="/detail" exact element={<Detail />} />
        <Route path="/success" exact element={<Success />} />
        <Route path="/taskdetail" exact element={<TaskDetail />} />
        <Route path="/websitedetail" exact element={<WebsiteDetail />} />
        <Route path="/messagedetail" exact element={<MessageDetail />} />
        <Route path="/crowddetail" exact element={<CrowdDetail />} />
        <Route path="/admineventclick" exact element={<AdminEventClick />} />
        <Route path="/membereventclick" exact element={<MemberEventClick />} />
        <Route path="/unauthorized" exact element={<Unauthorized />} />
      </Routes>
    </Router>
  );
}

export default App;
